#include <iostream>

class Vector2D {
public:
    double x, y;

    // 构造函数
    Vector2D(double x = 0, double y = 0) : x(x), y(y) {}

    // 加法运算符重载
    Vector2D operator+(const Vector2D& v) {
        return Vector2D(x + v.x, y + v.y);
    }

    // 减法运算符重载
    Vector2D operator-(const Vector2D& v) {
        return Vector2D(x - v.x, y - v.y);
    }

    // 乘法运算符重载（点乘）
    double operator*(const Vector2D& v) {
        return x * v.x + y * v.y;
    }

    // 输出运算符重载
    friend std::ostream& operator<<(std::ostream& os, const Vector2D& v) {
        os << "(" << v.x << ", " << v.y << ")";
        return os;
    }
};

int main() {
    Vector2D v1(1.0, 2.0), v2(3.0, 4.0);

    std::cout << "v1 = " << v1 << "\n";
    std::cout << "v2 = " << v2 << "\n";
    std::cout << "v1 + v2 = " << v1 + v2 << "\n";
    std::cout << "v1 - v2 = " << v1 - v2 << "\n";
    std::cout << "v1 * v2 = " << v1 * v2 << "\n";

    return 0;
}
